#!/bin/bash

container_name=$(docker ps  -a --format "table {{.Names}}" | grep 关键字)

container=(${container_name// / })
file='gc_'$(date +%Y%m%d -d 'yesterday').log
sudo touch /var/$file

for c in ${container[@]}
do
    sudo echo $c
    sudo echo -e $c >> /var/$file
    sudo echo "$(docker exec $c jstat -gcutil 1)" >> /var/$file
done
sudo mail -s "cs3-nginx-master-eu-everyday Gc inspect ！" 邮箱 < /var/$file